@extends('layouts.head')



@section('content')

<style>
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #20a0ff;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 164px;
    height: 164px;
    line-height: 164px;
    text-align: center;
  }
  .avatar {
    width: 100px;
    height: 100px;
    display: block;
  }
   .el-row {
    margin-bottom: 2px;
    &:last-child {
      margin-bottom: 0;
    }
  }
</style>
<style>
  .el-select .el-input {
    width: 120px;
  }
</style>
<section class="content"  id="content" v-cloak>
<div class="box box-solid" >
  <div class="box-header with-border">
  <el-button-group>
          <el-button @click="getAllNew"   type="info"   size="small" >刷新</el-button>
    </el-button-group> 
    <el-button-group>
          <el-button v-if="group == 3|| group == 2 " @click="payConfirm" type="warning" :disabled="!isCheckOne"  size="small" >付款确认</el-button>
          <el-button v-if="group == 3|| group == 2 " @click="costConfirm" type="warning" :disabled="!isCheckOne"  size="small" >收款确认</el-button>
    </el-button-group> 
    <el-input placeholder="关键字" style="width:340px" v-model="searchWord" size="small">
    <el-select v-model="searchType" slot="prepend" placeholder="搜索类型">
      <el-option label="商品" value="name"></el-option>
      <el-option label="订单号" value="orderNo"></el-option>
      <el-option label="客户" value="clientName"></el-option>
    </el-select>
    <el-button slot="append" icon="search"  @click="searchOrder"  ></el-button>
    </el-input>
    <el-button size="small" type=""  @click="yesterday" icon="arrow-left"></el-button>
    <el-date-picker v-model="date" style="width: 120px" size="small" type="date" placeholder="选择日期" > </el-date-picker>
    <el-button  size="small" type="" @click="tomorrow"  icon="arrow-right" ></el-button>    
    
  </div>
  <div class="box-body " >
         <el-table ref="multipleTable" :data="orders" border bordertooltip-effect="dark" border="true"  
    @current-change="lookRow"   @selection-change="checkOne" style="width: 100%;font-size: xx-small;" >
            <el-table-column type="selection" width="40">  </el-table-column>
            <el-table-column  fixed="left" type="index" width="40" > </el-table-column>
            <el-table-column  fixed="left" label="订单信息"  width="300" > 
                        <template scope="scope">
                           <div  v-for="item in orderGoods "  v-if="item.orderId == scope.row.id ">
                              <el-row  :gutter="2">
                              <el-col :span="24"><div >订单号：@{{ scope.row.orderNo }}</div></el-col>
                              </el-row>
                              <el-row :gutter="2">
                                <el-col :span="24"><div >商品：@{{item.name}}</div></el-col>
                              </el-row>
                              <el-row :gutter="2">
                                <el-col :span="12"><div ><img :src=" '{{$aliOssUrl}}/'+item.img"  class ="avatar "></div></el-col>
                                <el-col :span="12">
                                  <el-row :gutter="2">
                                    <el-col :span="24"><div>进价：<a>@{{item.inPrice}}</a></div></el-col>
                                  </el-row>
                                  <el-row :gutter="2">
                                    <el-col :span="24"><div>售价：<a>@{{item.salePrice}}</a></div></el-col>
                                  </el-row>
                                  <el-row :gutter="2">
                                    <el-col :span="24"> <div>数量：<a>@{{item.count}}</a></div></el-col>
                                  </el-row>
                                  <el-row :gutter="2">
                                    <el-col :span="24"> <div>合计：<a>@{{item.cost}}</a></div></el-col>
                                  </el-row>
                                </el-col>
                              </el-row>
             
                            </div>

                          </template>
            </el-table-column>
            <el-table-column fixed="left"  prop="other1" label="状态" width="150">
                <template scope="scope">
                    <el-row :gutter="2">
                      <el-col :span="18"><div >采购</div></el-col>
                      <el-col :span="6">
                        <div >
                          <el-tag  v-if="scope.row.state > 1" type="success">Yes</el-tag >
                          <el-tag  v-else type="warning" >No</el-tag >
                        </div>
                      </el-col>
                    </el-row>
                    <el-row :gutter="2">
                      <el-col :span="18"><div >国外发货</div></el-col>
                      <el-col :span="6">
                        <div >
                          <el-tag  v-if="scope.row.state > 2" type="success">Yes</el-tag >
                                              <el-tag  v-else type="warning">No</el-tag >
                        </div>
                      </el-col>
                    </el-row>
                    <el-row :gutter="2">
                      <el-col :span="18"><div >国内到货</div></el-col>
                      <el-col :span="6">
                        <div >
                          <el-tag  v-if="scope.row.state > 3" type="success">Yes</el-tag >
                                              <el-tag  v-else type="warning">No</el-tag >
                        </div>
                      </el-col>
                    </el-row>
                    <el-row :gutter="2">
                      <el-col :span="18"><div >国内转发(直邮)</div></el-col>
                      <el-col :span="6">
                        <div >
                          <el-tag  v-if="scope.row.state > 4" type="success">Yes</el-tag >
                                              <el-tag  v-else type="warning">No</el-tag >
                        </div>
                      </el-col>
                    </el-row>
                    <el-row :gutter="2">
                      <el-col :span="18"><div >客户到货</div></el-col>
                      <el-col :span="6">
                        <div >
                          <el-tag  v-if="scope.row.state > 5" type="success">Yes</el-tag >
                                              <el-tag  v-else type="warning">No</el-tag >
                        </div>
                      </el-col>
                    </el-row>
                </template>
             </el-table-column>
             <el-table-column fixed="left"  label="款项状态" width="90">
                <template scope="scope">
                  <el-row :gutter="2">
                    <el-col :span="12"><div >付款</div></el-col>
                    <el-col :span="12">
                      <div >
                        <el-tag v-if="scope.row.payState == 1" type="success">Yes</el-tag>
                        <el-tag v-else type="warning">No</el-tag>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row :gutter="2">
                    <el-col :span="12"><div >收款</div></el-col>
                    <el-col :span="12">
                      <div >
                        <el-tag v-if="scope.row.costState == 1" type="success">Yes</el-tag>
                        <el-tag v-else type="warning">No</el-tag>
                      </div>
                    </el-col>
                  </el-row>
                </template>
             </el-table-column>
            <el-table-column  prop="date" label="时间" width="100"> </el-table-column>
            <el-table-column  prop="cost" label="总额" > </el-table-column>
            <el-table-column  prop="imprest" label="预付款" > </el-table-column>
            <el-table-column  prop="clientName" label="客户" > </el-table-column>
            <el-table-column  prop="sellName" label="销售" > </el-table-column>
            <el-table-column  prop="buyerName" label="买手" > </el-table-column>
            <el-table-column  prop="expressType" label="快递方式" > </el-table-column>
            <el-table-column  prop="express" label="意大利快递" width="100" > </el-table-column>
            <el-table-column  prop="expressNo" label="快递编号" > </el-table-column>
            <el-table-column  prop="express2" label="国内快递" > </el-table-column>
            <el-table-column  prop="expressNo2" label="快递编号" > </el-table-column>
           
<!--             <el-table-column fixed="right"  label="操作"  width="120">
                <template scope="scope">
                  <el-button-group>
                     
                      <el-button  @click="sellRow(scope.row.id, orders)" type="primary" icon=" " size="mini">编辑</el-button>
                      <el-button  @click="delRow(scope.row.id, orders)" type="danger" icon=" " size="mini">删除</el-button>
                  </el-button-group>     
                </template>
            </el-table-column> -->
        </el-table>
        </br>
        <div class="block">
            <el-pagination @size-change=""  @current-change="getOrdersCurrentPage" :current-page="ordersCurrentPage" :page-size="10" layout="total, prev, pager, next, jumper" :total="ordersCount">
            </el-pagination>
        </div>
  </div>
</div>



<el-dialog title="订单确认" :visible.sync="confirmV"  size="tiny" >
  <el-form ref="form" :model="confirmItem" label-width="80px">
    <el-form-item label="支付方式">
    <el-radio-group v-model="confirmItem.costType">
    <el-radio-button label="线下支付"></el-radio-button>
    <el-radio-button label="余额支付"></el-radio-button>
  </el-radio-group>
  </el-form-item>
  <el-form-item label="预付款">
    <el-input-number  :min="0.01" :step="0.01"  v-model="confirmItem.imprest"></el-input-number>
  </el-form-item>
  <el-form-item label="备注">
      <el-input v-model="confirmItem.notes" type="textarea"  size="small" ></el-input>
  </el-form-item>
  </el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="confirmV = false">取 消</el-button>
    <el-button type="primary" @click="submitConfirmOrder">确定</el-button>
  </span>
</el-dialog>

<el-dialog title="买手确认" :visible.sync="confirmBuyV"  size="tiny" >
  确认是否有货？
  <table  class="table table-hover">
      <thead>   
      </thead>
      <tr>
        <td style="width: 45px" >采购价格</td>
        <td>  
              <el-input v-model="inPrice"  size="small" placeholder="请输入内容"></el-input>
        </td>
      </tr>
    </table>
  <span slot="footer" class="dialog-footer">
    <el-button @click="confirmBuyV = false">取 消</el-button>
    <el-button type="primary" @click="submitNoGoods">无货</el-button>
    <el-button type="primary" @click="submitHaveGoods">有货</el-button>
  </span>
</el-dialog>

<el-dialog title="发货确认" :visible.sync="confirmOutV"  size="tiny" >
  <el-form ref="form" :model="outItem" label-width="80px">
    <el-form-item label="快递方式">
    <el-radio-group v-model="outItem.expressType">
    <el-radio-button label="直邮"></el-radio-button>
    <el-radio-button label="国内转发"></el-radio-button>
  </el-radio-group>
  </el-form-item>
  <el-form-item label="物流">
      <el-input v-model="outItem.express"  size="small" ></el-input>
  </el-form-item>
  <el-form-item label="物流单号">
      <el-input v-model="outItem.expressNo"  size="small" ></el-input>
  </el-form-item>
  <el-form-item label="物流费用">
      <el-input v-model="outItem.expressCost"  size="small" ></el-input>
  </el-form-item>
  </el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="confirmOutV = false">取 消</el-button>
    <el-button type="primary" @click="submitOut">确定</el-button>
  </span>
</el-dialog>

<el-dialog title="国内收货确认" :visible.sync="chinaGetV"  size="tiny" >
  确认收货？
  <span slot="footer" class="dialog-footer">
    <el-button @click="confirmBuyV = false">取 消</el-button>
    <el-button type="primary" @click="submitChinaGet">确认</el-button>
  </span>
</el-dialog>

<el-dialog title="国内发货确认" :visible.sync="chinaOutV"  size="tiny" >
  <el-form ref="form" :model="outItem2" label-width="80px">
  <el-form-item label="物流">
      <el-input v-model="outItem2.express2"  size="small" ></el-input>
  </el-form-item>
  <el-form-item label="物流单号">
      <el-input v-model="outItem2.expressNo2"  size="small" ></el-input>
  </el-form-item>
  <el-form-item label="物流费用">
      <el-input v-model="outItem.expressCost2"  size="small" ></el-input>
  </el-form-item>
  </el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="confirmOutV = false">取 消</el-button>
    <el-button type="primary" @click="submitChinaOut">确定</el-button>
  </span>
</el-dialog>

<el-dialog title="收款确认" :visible.sync="costConfirmV"  size="tiny" >
  <el-form ref="form" :model="receiptItem" label-width="80px">
    <el-form-item label="总金额">
      商品总价：@{{editOrderItem.cost}}<br>
      快递费：@{{editOrderItem.expressCost +editOrderItem.expressCost2}} <br>
      预付：@{{editOrderItem.imprest}}<br>
      应付：@{{editOrderItem.cost+editOrderItem.expressCost +editOrderItem.expressCost2 - editOrderItem.imprest}} 
  </el-form-item>
  <el-form-item label="此次收款">
    <el-input    v-model="receiptItem.receipt"></el-input>
  </el-form-item>
  <el-form-item label="收款账户">
    <el-input    v-model="receiptItem.receiptNo"></el-input>
  </el-form-item>
  <el-form-item label="收款时间">
     <el-date-picker v-model="receiptItem.receiptDate" style="width: 120px" size="small" type="date" placeholder="选择日期" > </el-date-picker>
  </el-form-item>
  </el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="costConfirmV = false">取 消</el-button>
    <el-button type="primary" @click="submitCostOrder">确定</el-button>
  </span>
</el-dialog>

<el-dialog title="付款确认" :visible.sync="payConfirmV"  size="tiny" >
    <el-form ref="form" :model="editOrderItem" label-width="80px">
      <el-form-item label="买手">
         @{{editOrderItem.buyerName}}
      </el-form-item>
      <el-form-item label="应付款">
       @{{editOrderItem.pay}}<br>
      </el-form-item>
    </el-form>
  <span slot="footer" class="dialog-footer">
    <el-button @click="payConfirmV = false">取 消</el-button>
    <el-button type="primary" @click="submitPayOrder">确定付款</el-button>
  </span>
</el-dialog>





</section>
<script >
    var content =new Vue({
        el:'#content',
        data:{
            date:'<?php echo date('Y-m-d') ?>',
            addOrderV:false,
            confirmV:false,
            confirmBuyV:false,
            confirmOutV:false,
            confirmcostV:false,
            chinaGetV:false,
            chinaOutV:false,
            finishV:false,
            payConfirmV:false,
            costConfirmV:false,
            userId:'{{ Auth::user()->id }}',
            userName:'{{ Auth::user()->name }}',
            company:'{{ Auth::user()->company }}',
            group:'{{ Auth::user()->group }}',
            inPrice:'',
            clients:[],
            goods:[],
            orderGoods:[],
            orders:[],
            orderChrildren:[],
            ordersCount:1,
            ordersCurrentPage:1,
            type:'',
            searchWord:'',
            searchType:'',
            orderState:0,
            addOrderItem:{type:'2',clientId:'',sellId:'{{ Auth::user()->id }}',sellName:'{{ Auth::user()->name}}',ordererId:'{{ Auth::user()->id }}',ordererName:'{{ Auth::user()->name}}',company:'{{ Auth::user()->company }}',count:1,},
            addOrderGoodsItem:{name:'',company:'{{ Auth::user()->company }}',price:'',brand:'',color:'',size:'',salePrice:'',discount:''},
            editOrderItem:[],
            confirmItem:{costType:'',imprest:0.00,notes:'' ,sellId:'{{ Auth::user()->id }}',sellName:'{{ Auth::user()->name }}',},
            outItem:{express:'',expressNo:'',expressType:''},
            outItem2:{express2:'',expressNo2:''},
            addGoods:[],
            multipleSelection: [],
            costItem:[],
            payItem:[],
            brand:[],
            color:[],
            size:[],
            imgV:false,
            imgUrl:'',
            imgAll:[],
            flowState:'',
            receiptItem:{receipt:'',receiptType:'',receiptNo:'',receiptDate:''},
        },
        created:function(){
            this.$http.get('/orderGoods/getAll/'+this.company).then((response) => {this.orderGoods=response.data; console.log('11');console.log(response.data)},(response) =>{ }); 
            this.$http.get('/order/getCurrent/'+this.ordersCurrentPage+'/'+this.company).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
            this.$http.get('/order/getCount/'+this.company).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ }); 
            this.$http.get('/client/getAll/'+this.company).then((response) => {this.clients=response.data; console.log(response.data)},(response) =>{ }); 
            this.$http.get('/brand/getAll/'+this.company).then((response) => {this.brand=response.data; console.log(response.data)},(response) =>{ });
            this.$http.get('/color/getAll/'+this.company).then((response) => {this.color=response.data; console.log(response.data)},(response) =>{ });    
            this.$http.get('/size/getAll/'+this.company).then((response) => {this.size=response.data; console.log(response.data)},(response) =>{ });  

        },
        computed: {
              isCheckOne:function(){
                if( this.multipleSelection.length == 1 ){
                  return true;
                }else{
                  return false;
                }
              },
              salePrice:function(){
                return this.addOrderGoodsItem.price*this.addOrderGoodsItem.discount
              }
        },
        methods:{

              searchOrder:function(){
                  console.log(this.searchWord);
                  this.$http.get('/order/search/'+this.searchWord+'/'+this.searchType+'/'+this.company).then((response) => {this.orders=response.data; this.ordersCount = this.orders.length;console.log('word,orders,success')},(response) =>{ console.log(response);}); 
                  
              } ,
              yesterday:function(){
                  console.log('yesterday');
              },
              tomorrow:function(){
                  console.log('tomorrow');
              },

              
              addInDate:function(){

              },
              addGoodsImg(res, file) {
                      this.imgUrl='http://link51888.oss-eu-central-1.aliyuncs.com/'+res;
                       this.imgAll.push( this.imgUrl);
                      console.log(this.imgAll);
                      this.addOrderGoodsItem.img='http://link51888.oss-eu-central-1.aliyuncs.com/'+res;
                    },

              beforeAvatarUpload(file) {
                      const isJPG = file.type === 'image/jpeg';
                      const isLt2M = file.size / 1024 / 1024 < 2;

                      if (!isJPG) {
                        this.$message.error('上传头像图片只能是 JPG 格式!');
                      }
                      if (!isLt2M) {
                        this.$message.error('上传头像图片大小不能超过 2MB!');
                      }
                      return isJPG && isLt2M;
                    },
              getAllNew:function(){
                  this.$http.get('/order/getCurrent/'+this.ordersCurrentPage+'/'+this.company).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                  this.$http.get('/order/getCount/'+this.company).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ }); 
              },
              getNew:function(){
                  this.orderState=0;
                  this.$http.get('/order/getCurrentState/'+this.ordersCurrentPage+'/'+this.company+'/'+this.orderState).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                  this.$http.get('/order/getCountState/'+this.company+'/'+this.orderState).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ }); 

              },
              getSell:function(){
                  this.orderState=1;
                  this.$http.get('/order/getCurrentState/'+this.ordersCurrentPage+'/'+this.company+'/'+this.orderState).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                  this.$http.get('/order/getCountState/'+this.company+'/'+this.orderState).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ }); 

              },
              getBuy:function(){
                  this.orderState=2;
                  this.$http.get('/order/getCurrentState/'+this.ordersCurrentPage+'/'+this.company+'/'+this.orderState).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                  this.$http.get('/order/getCountState/'+this.company+'/'+this.orderState).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ }); 

              },
              getOut:function(){
                  this.orderState=3;
                  this.$http.get('/order/getCurrentState/'+this.ordersCurrentPage+'/'+this.company+'/'+this.orderState).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                  this.$http.get('/order/getCountState/'+this.company+'/'+this.orderState).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ }); 

              },
              getFinish:function(){
                  this.orderState=9;
                  this.$http.get('/order/getCurrentState/'+this.ordersCurrentPage+'/'+this.company+'/'+this.orderState).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                  this.$http.get('/order/getCountState/'+this.company+'/'+this.orderState).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ }); 

              },
              
              submitAddOrder:function(){
                  console.log('submitAddOrder');
                  this.addOrderGoodsItem.salePrice=this.salePrice;
                  this.addOrderGoodsItem.cost=this.addOrderGoodsItem.salePrice*this.addOrderGoodsItem.count;
                  this.addOrderItem.cost=this.addOrderGoodsItem.cost
                  console.log(this.addOrderGoodsItem.salePrice);
                  this.$http.post('/order/addNewGoods',{_token:'{{csrf_token()}}',order:this.addOrderItem,goods:this.addOrderGoodsItem,imgs:this.imgAll}).then((response)=>{this.$notify.info(response.data);
                              this.imgAll=[];
                              this.$http.get('/order/getCurrent/'+this.ordersCurrentPage+'/'+this.company).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                              this.$http.get('/order/getCount/'+this.company).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ });    
                              this.$http.get('/orderGoods/getAll/'+this.company).then((response) => {this.orderGoods=response.data; console.log('11');console.log(response.data)},(response) =>{ }); 
                        },(response) =>{ });

              },
              submitConfirmOrder:function(){
                  console.log('submitConfirmOrder');
                  this.$http.post('/order/newConfirm/'+this.editOrderItem.id,{_token:'{{csrf_token()}}',date:this.confirmItem}).then((response)=>{this.$notify.info(response.data);
                              this.$http.get('/order/getCurrent/'+this.ordersCurrentPage+'/'+this.company).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                              this.$http.get('/order/getCount/'+this.company).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ });    
                        },(response) =>{ });

              },
              submitOut:function(){
                  console.log('submitOut');
                  this.confirmOutV=false;
                  this.$http.post('/order/outConfirm/'+this.editOrderItem.id,{_token:'{{csrf_token()}}',date:this.outItem}).then((response)=>{this.$notify.info(response.data);
                              this.$http.get('/order/getCurrent/'+this.ordersCurrentPage+'/'+this.company).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                              this.$http.get('/order/getCount/'+this.company).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ });    
                        },(response) =>{ });

              },
              submitChinaGet:function(){
                  console.log('submitChinaGet');
                  this.chinaGetV=false;
                  this.$http.post('/order/chinaGetConfirm/'+this.editOrderItem.id,{_token:'{{csrf_token()}}'}).then((response)=>{this.$notify.info(response.data);
                              this.$http.get('/order/getCurrent/'+this.ordersCurrentPage+'/'+this.company).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                              this.$http.get('/order/getCount/'+this.company).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ });    
                        },(response) =>{ });

              },

              submitChinaOut:function(){
                  console.log('submitChinaOut');
                  this.chinaOutV=false;
                  this.$http.post('/order/chinaOutConfirm/'+this.editOrderItem.id,{_token:'{{csrf_token()}}',date:this.outItem2}).then((response)=>{this.$notify.info(response.data);
                              this.$http.get('/order/getCurrent/'+this.ordersCurrentPage+'/'+this.company).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                              this.$http.get('/order/getCount/'+this.company).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ });    
                        },(response) =>{ });
                 
              },
              submitHaveGoods:function(){
                  console.log('submitHaveGoods');
                  this.confirmBuyV=false;
                  this.$http.post('/order/haveGoods/'+this.editOrderItem.id,{_token:'{{csrf_token()}}',date:'商品有货',inPrice:this.inPrice,buyerId:this.userId,buyerName:this.userName}).then((response)=>{this.$notify.info(response.data);
                              this.$http.get('/order/getCurrent/'+this.ordersCurrentPage+'/'+this.company).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                              this.$http.get('/order/getCount/'+this.company).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ });    
                        },(response) =>{ });
                 
              },
              submitNoGoods:function(){
                  console.log('submitNoGoods');
                  this.confirmBuyV=false;
                  this.$http.post('/order/noGoods/'+this.editOrderItem.id,{_token:'{{csrf_token()}}',date:'商品无货',buyerId:this.userId,buyerName:this.userName}).then((response)=>{this.$notify.info(response.data);
                              this.$http.get('/order/getCurrent/'+this.ordersCurrentPage+'/'+this.company).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                              this.$http.get('/order/getCount/'+this.company).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ });    
                        },(response) =>{ });
                 
              },
              submitCostOrder:function(){
                  console.log('submitCostOrder');
                  this.confirmcostV = false;
                  this.$http.post('/order/costConfirm/'+this.editOrderItem.id,{_token:'{{csrf_token()}}',receipt:this.receiptItem}).then((response)=>{this.$notify.info(response.data);
                              this.$http.get('/order/getCurrent/'+this.ordersCurrentPage+'/'+this.company).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                              this.$http.get('/order/getCount/'+this.company).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ }); 

                        },(response) =>{ });
              },
              submitPayOrder:function(){
                  console.log('submitPayrder');
                  this.confirmcostV = false;
                  this.$http.post('/order/payConfirm/'+this.editOrderItem.id,{_token:'{{csrf_token()}}'}).then((response)=>{this.$notify.info(response.data);
                              this.$http.get('/order/getCurrent/'+this.ordersCurrentPage+'/'+this.company).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                              this.$http.get('/order/getCount/'+this.company).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ }); 

                        },(response) =>{ });
              },
              cancelAddOrder:function(){
                  console.log('cancelAddOrder');
              },
              lookRow:function(val){
                  console.log(val);
              },
              buyRow:function(){
                this.confirmBuyV=true;
                this.editOrderItem=this.multipleSelection[0]
              },
              sellRow:function(){
                 this.confirmV=true;
                 this.editOrderItem=this.multipleSelection[0]
              },
              outRow:function(){
                this.confirmOutV=true;
                this.editOrderItem=this.multipleSelection[0]
              },
              costRow:function(){
                this.confirmcostV=true;
                this.editOrderItem=this.multipleSelection[0]
                this.costItem.cost=this.multipleSelection[0]['cost'];
                this.costItem.imprest=this.multipleSelection[0]['imprest'];
                this.costItem.lastCost=this.multipleSelection[0]['cost']-this.multipleSelection[0]['imprest'];
              },
              finishRow:function(){
                this.finishV=true;
                this.editOrderItem=this.multipleSelection[0]
              },
              chinaGetRow:function(){
                this.chinaGetV=true;
                this.editOrderItem=this.multipleSelection[0]
              },
              chinaOutRow:function(){
                this.chinaOutV=true;
                this.editOrderItem=this.multipleSelection[0]
              },
              payConfirm:function(){
                this.payConfirmV = true;
                this.editOrderItem=this.multipleSelection[0]
              },
              costConfirm:function(){
                this.costConfirmV=true;
                this.editOrderItem=this.multipleSelection[0]
              },
              delRow:function(val){
                  console.log(val);
                  this.$http.post('/order/del',{_token:'{{csrf_token()}}',date:this.multipleSelection}).then((response) => {this.$notify.info(response.data);
                                 this.$http.get('/order/getCurrent/'+this.ordersCurrentPage+'/'+this.company).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                                 this.$http.get('/order/getCount/'+this.company).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ });    

                          },(response) =>{ }); 

              },
              getOrdersCurrentPage:function(val){
                  console.log(val);
                  this.ordersCurrentPage=val;
                   this.$http.get('/order/getCurrent/'+this.ordersCurrentPage+'/'+this.company).then((response) => {this.orders=response.data; console.log(response.data)},(response) =>{ }); 
                              this.$http.get('/order/getCount/'+this.company).then((response) => {this.ordersCount=response.data; console.log(response.data)},(response) =>{ });    
              },
            
              checkOne:function (val) {
                console.log('checkOne');
                this.multipleSelection = val;
                 if( this.multipleSelection.length == 1 ){
                  this.flowState = this.multipleSelection[0].state;
                  this.payState=this.multipleSelection[0].payState;
                  this.costState=this.multipleSelection[0].costState;
                  console.log(this.flowState);
                }else{
                  this.flowState = 999;
                  this.payState=999;
                  this.costState=999;
                  console.log(this.flowState);
                }
              } ,
         },

  });
</script>




@endsection

@section('pagejs')

@endsection

        




